Skip to content

Disk spill with scaling improvements#486

Closed
gabrielbosio wants to merge 8 commits into
perf/disk-spill-time-regressionfrom
perf/disk-spill-time-regression-scaling
Closed

Disk spill with scaling improvements#486
gabrielbosio wants to merge 8 commits into
perf/disk-spill-time-regressionfrom
perf/disk-spill-time-regression-scaling

Conversation

@gabrielbosio

Copy link
Copy Markdown
Collaborator

A merge of #476 with the first 5 commits of #483 to check how heap peak gets reduced.

diegokingston and others added 5 commits April 9, 2026 16:21
Tables with effective width < 42 were sized at 2^21, producing single
large chunks. Capping at 2^20 produces 2x more chunks of the standard
size, improving parallel throughput and keeping peak memory per chunk
uniform across all tables.
Tables sharing the same lde_size now reuse a single Arc<LdeTwiddles>
instead of each allocating their own copy. This avoids redundant twiddle
computation and allocation when multiple tables happen to have the same
trace length (e.g., all 2^19-row tables after the cap change).
Under the `parallel` feature, fold each conjugate pair concurrently
using `par_chunks(2).zip(inv_twiddles.par_iter())`, collecting into a
new Vec of half length. The sequential path (no `parallel` feature) is
unchanged. This avoids the index aliasing issue from an in-place
interleaved write.
Replace the per-row `Vec` allocation inside the iterator with a
thread-local buffer via Rayon's `map_init` (parallel path) or a single
buffer allocated outside the loop (sequential path). This avoids one
heap allocation per row during Merkle tree construction.
Comment thread crypto/stark/src/prover.rs
Comment thread crypto/stark/src/fri/fri_functions.rs
@gabrielbosio

Copy link
Copy Markdown
Collaborator Author

/bench

@github-actions

github-actions Bot commented Apr 9, 2026

Copy link
Copy Markdown

Benchmark — fib_iterative_8M (median of 3)

Table parallelism: 32 (auto = cores / 3)

Metric main PR Δ
Peak heap 221229 MB 28010 MB -193219 MB (-87.3%) 🟢
Prove time 46.773s 50.749s +3.976s (+8.5%) 🔴

⚠️ Regression detected — heap or time increased by more than 5%.

⚠️ Heap spread: 6.3% (27498 MB / 28010 MB / 29266 MB)
Consider re-running /bench

Commit: bddf96a · Baseline: built from main · Runner: self-hosted bench

@yetanotherco yetanotherco deleted a comment from claude Bot Apr 9, 2026
@yetanotherco yetanotherco deleted a comment from github-actions Bot Apr 9, 2026
@gabrielbosio
gabrielbosio marked this pull request as ready for review April 9, 2026 20:55
Comment thread crypto/stark/src/prover.rs Outdated
@yetanotherco yetanotherco deleted a comment from github-actions Bot Apr 10, 2026
@yetanotherco yetanotherco deleted a comment from claude Bot Apr 10, 2026
… into perf/disk-spill-time-regression-scaling
@gabrielbosio

Copy link
Copy Markdown
Collaborator Author

/bench

@gabrielbosio

Copy link
Copy Markdown
Collaborator Author

Since #497 exists, I think it doesn't make sense to keep this PR open.

@gabrielbosio
gabrielbosio deleted the perf/disk-spill-time-regression-scaling branch April 20, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants